package zjhr.com.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import zjhr.com.mapper.ZjOutmoneyMapper;
import zjhr.com.pojo.EasyUIPageQuery;
import zjhr.com.pojo.ZjInmoney;
import zjhr.com.pojo.ZjOutmoney;
import zjhr.com.pojo.ZjOutmoneyExample;
import zjhr.com.service.OutMoneyService;
import zjhr.com.utils.IDUtils;
@Service
public class OutMoneyServiceImpl implements OutMoneyService{
	@Autowired
	private ZjOutmoneyMapper outMoneyMapper;

	@Override
	public void save(ZjOutmoney outmoney) {
		outmoney.setOutid(IDUtils.genImageName());
		outMoneyMapper.insert(outmoney);
		
	}

	@Override
	public EasyUIPageQuery pageQuery(Integer page, Integer rows) {
		ZjOutmoneyExample example = new ZjOutmoneyExample();
		int total = outMoneyMapper.countByExample(example);
		int start = (page-1)*rows;
		List<ZjOutmoney> list = outMoneyMapper.selectPageQuery(start, rows.intValue());
		EasyUIPageQuery pageQuery = new EasyUIPageQuery(total, list);
		return pageQuery;
	}
	
	@Override
	public void edit(ZjOutmoney outmoney) {
		
		outMoneyMapper.updateByPrimaryKey(outmoney);
	}
	//
	@Override
	public List<ZjOutmoney> selectAll(String beginDate,String endDate) {
		ZjOutmoneyExample example = new ZjOutmoneyExample();
		List<ZjOutmoney> list = outMoneyMapper.selectByDate(beginDate, endDate);
		return  list;
	}

}
